package com.yaoxun.bored.model.sys.user;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Min;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

import com.yaoxun.bored.common.BaseModel;

@Table(name="b_user")
public class User extends BaseModel implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="user_id")
	private Integer userId;
	
	@NotEmpty(message="请填写账号")
	@Pattern(regexp="^[0-9a-zA-Z]{6,18}", message="输入正确账号")
	private String account;
	
	@NotEmpty(message="请填写密码")
	@Pattern(regexp="^[\\S]{6,18}$", message="输入正确密码")
	private String pwd;
	
	@NotEmpty(message="请填写电话")
	@Pattern(regexp="^1[3|4|5|6|7|8|9][0-9]\\d{4,8}$", message="请填写正确的手机号")
	private String telphone;
	
	@Column(name="user_type")
	@Min(value=0, message="类型不合法")
	private Integer userType = 0;
	
	@Column(name="user_status")
	@Min(value=0, message="状态不合法")
	private Integer userStatus = 0;
	
	@Size(max=255, message="最多输入255个字")
	private String remark;
	
	private String salt;
	

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getPwd() {
		return pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public String getTelphone() {
		return telphone;
	}

	public void setTelphone(String telphone) {
		this.telphone = telphone;
	}

	public Integer getUserType() {
		return userType;
	}

	public void setUserType(Integer userType) {
		this.userType = userType;
	}

	public Integer getUserStatus() {
		return userStatus;
	}

	public void setUserStatus(Integer userStatus) {
		this.userStatus = userStatus;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	@Override
	public String toString() {
		return "User [userId=" + userId + ", account=" + account + ", pwd=" + pwd + ", telphone=" + telphone
				+ ", userType=" + userType + ", userStatus=" + userStatus + ", remark=" + remark + ", salt=" + salt
				+ ", toString()=" + super.toString() + "]";
	}

}
